import { NextResponse, NextMiddleware } from "next/server";
import type { NextFetchEvent, NextRequest } from "next/server";

// export function middleware(request: NextRequestt) {
//     // if (request.nextUrl.pathname.startsWith("/about")) {
//     //     return NextResponse.rewrite(new URL("/routing/route-handlers/stream", request.url));
//     // }

//     // if (request.nextUrl.pathname.startsWith("/dashboard")) {
//     //     return NextResponse.rewrite(new URL("/dashboard/user", request.url));
//     // }
//     // console.log(event)
//     // if (request.nextUrl.pathname.startsWith("/dashboard")) {
//     //     return NextResponse.rewrite(new URL("/dashboard/user", request.url));
//     // }
//     console.log(request.nextUrl.pathname)
// }

export function middleware(request: NextRequest) {
    console.log('request.nextUrl.pathname', request.nextUrl.pathname)
    // if (request.nextUrl.pathname.startsWith('/layout/todo/')) {
    //     // 拦截到弹窗路由
    //     console.log(new URL(`/layout/@modal${request.nextUrl.pathname}`, request.url).toJSON());
    //     return NextResponse.rewrite(
    //         new URL(`/layout/@modal${request.nextUrl.pathname.replaceAll('/layout/todo/', '')}`, request.url)
    //     );
    // }

    return NextResponse.next();
}